package algorithm.poj.p2000;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLDecoder;

public class P2313 {

	public static void main(String[] args) throws Exception {

		InputStream input = null;
		if (false) {
			input = System.in;
		} else {
			URL url = P2313.class.getResource("P2313.txt");
			File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
			input = new FileInputStream(file);
		}
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(input));

		String line = stdin.readLine();
		int N = Integer.valueOf(line.trim());
		int min = -1, max = -1;
		for (int i = 0; i < N; i ++) {
			int n = Integer.valueOf(stdin.readLine().trim());
			if (i == 0) {
				min = max = n;
			} else {
				if (min > n) min = n;
				if (max < n) max = n;
			}
		}
		System.out.println(max-min);
	}
}